namespace java.swift net.gdface.sdk.decorator
namespace cpp gdface
namespace java net.gdface.sdk.thrift.client
namespace py gdface.thrift


enum MatType {
  NV21, RGB, BGR, RGBA, GRAY
}

struct FAngle {
  1: required double confidence;
  2: required i32 pitch;
  3: required i32 roll;
  4: required i32 yaw;
}

struct EyeInfo {
  1: required i32 leftx;
  2: required i32 lefty;
  3: required i32 rightx;
  4: required i32 righty;
}

struct FInt2 {
  1: required i32 x;
  2: required i32 y;
}

struct FRect {
  1: required i32 height;
  2: required i32 left;
  3: required i32 top;
  4: required i32 width;
}

exception ImageErrorException {
  1: optional string message;
  2: optional string causeClass;
  3: optional string serviceStackTraceMessage;
  4: optional string causeFields;
}

exception NotFaceDetectedException {
  1: optional string message;
  2: optional string causeClass;
  3: optional string serviceStackTraceMessage;
  4: optional string causeFields;
  5: required i32 codeNum;
  6: required i32 faceNum;
}

exception ServiceRuntimeException {
  1: optional string message;
  2: optional string causeClass;
  3: optional string serviceStackTraceMessage;
  4: optional string causeFields;
  5: required i32 type;
}

struct FseResult {
  1: optional binary featureId;
  2: optional string owner;
  3: required double similarity;
}

struct CodeInfo {
  1: optional FAngle angle;
  2: optional binary code;
  3: optional EyeInfo ei;
  4: optional binary facialData;
  5: optional FInt2 mouth;
  6: optional FInt2 nose;
  7: optional FInt2 offset;
  8: optional FRect pos;
  9: required i32 rotate;
}

struct CompareResult {
  1: optional list<CodeInfo> codes;
  2: optional list<double> similartys;
}

service FaceApi {
  double compare2Face(1: optional binary imgData1, 2: optional CodeInfo facePos1, 3: optional binary imgData2, 4: optional CodeInfo facePos2) throws (1: ImageErrorException ex1, 2: NotFaceDetectedException ex2, 3: ServiceRuntimeException ex3);
  double compareCode(1: optional binary code1, 2: optional binary code2) throws (1: ServiceRuntimeException ex1);
  list<double> compareCodes(1: optional binary code1, 2: optional list<CodeInfo> codes) throws (1: ServiceRuntimeException ex1);
  CompareResult compareFaces(1: optional binary code, 2: optional binary imgData, 3: required i32 faceNum) throws (1: ImageErrorException ex1, 2: NotFaceDetectedException ex2, 3: ServiceRuntimeException ex3);
  list<double> compareFeatures(1: optional binary code1, 2: optional list<binary> codes) throws (1: ServiceRuntimeException ex1);
  double detectAndCompare2Face(1: optional binary imgData1, 2: optional FRect detectRect1, 3: optional binary imgData2, 4: optional FRect detectRect2) throws (1: ImageErrorException ex1, 2: NotFaceDetectedException ex2, 3: ServiceRuntimeException ex3);
  list<CodeInfo> detectAndGetCodeInfo(1: optional binary imgData, 2: required i32 faceNum) throws (1: ImageErrorException ex1, 2: NotFaceDetectedException ex2, 3: ServiceRuntimeException ex3);
  CodeInfo detectCenterFace(1: optional binary imgData) throws (1: ImageErrorException ex1, 2: NotFaceDetectedException ex2, 3: ServiceRuntimeException ex3);
  list<CodeInfo> detectFace(1: optional binary imgData) throws (1: ImageErrorException ex1, 2: ServiceRuntimeException ex2);
  CodeInfo detectMaxFace(1: optional binary imgData) throws (1: ImageErrorException ex1, 2: NotFaceDetectedException ex2, 3: ServiceRuntimeException ex3);
  CodeInfo detectMaxFaceAndGetCodeInfo(1: optional binary imgData) throws (1: ImageErrorException ex1, 2: NotFaceDetectedException ex2, 3: ServiceRuntimeException ex3);
  list<CodeInfo> getCodeInfo(1: optional binary imgData, 2: required i32 faceNum, 3: optional list<CodeInfo> facePos) throws (1: NotFaceDetectedException ex1, 2: ServiceRuntimeException ex2);
  CodeInfo getCodeInfoSingle(1: optional binary imgData, 2: optional CodeInfo facePos) throws (1: ServiceRuntimeException ex1);
  binary getFeature(1: optional map<binary, CodeInfo> faces) throws (1: NotFaceDetectedException ex1, 2: ServiceRuntimeException ex2);
  bool hasFace(1: optional binary imgData) throws (1: ImageErrorException ex1, 2: ServiceRuntimeException ex2);
  bool isLocal() throws (1: ServiceRuntimeException ex1);
  list<CodeInfo> matDetectAndGetCodeInfo(1: optional MatType matType, 2: optional binary matData, 3: required i32 width, 4: required i32 height, 5: required i32 faceNum) throws (1: NotFaceDetectedException ex1, 2: ServiceRuntimeException ex2);
  list<CodeInfo> matDetectAndGetCodeInfoUnchecked(1: optional MatType matType, 2: optional binary matData, 3: required i32 width, 4: required i32 height) throws (1: ServiceRuntimeException ex1);
  list<CodeInfo> matDetectFace(1: optional MatType matType, 2: optional binary matData, 3: required i32 width, 4: required i32 height) throws (1: ServiceRuntimeException ex1);
  list<CodeInfo> matDetectFaceFacenum(1: optional MatType matType, 2: optional binary matData, 3: required i32 width, 4: required i32 height, 5: required i32 facenum) throws (1: NotFaceDetectedException ex1, 2: ServiceRuntimeException ex2);
  CodeInfo matDetectMaxFace(1: optional MatType matType, 2: optional binary matData, 3: required i32 width, 4: required i32 height) throws (1: NotFaceDetectedException ex1, 2: ServiceRuntimeException ex2);
  CodeInfo matDetectMaxFaceAndGetCodeInfo(1: optional MatType matType, 2: optional binary matData, 3: required i32 width, 4: required i32 height) throws (1: NotFaceDetectedException ex1, 2: ServiceRuntimeException ex2);
  list<CodeInfo> matGetCodeInfo(1: optional MatType matType, 2: optional binary matData, 3: required i32 width, 4: required i32 height, 5: required i32 facenum, 6: optional list<CodeInfo> facePos) throws (1: NotFaceDetectedException ex1, 2: ServiceRuntimeException ex2);
  CodeInfo matGetCodeInfoSingle(1: optional MatType matType, 2: optional binary matData, 3: required i32 width, 4: required i32 height, 5: optional CodeInfo facePos) throws (1: ServiceRuntimeException ex1);
  bool matHasFace(1: optional MatType matType, 2: optional binary matData, 3: required i32 width, 4: required i32 height) throws (1: ServiceRuntimeException ex1);
  list<FseResult> matSearchFaces(1: optional MatType matType, 2: optional binary matData, 3: required i32 width, 4: required i32 height, 5: optional CodeInfo facePos, 6: required double similarty, 7: required i32 rows, 8: optional list<string> imgMD5Set, 9: required i32 group) throws (1: ImageErrorException ex1, 2: NotFaceDetectedException ex2, 3: ServiceRuntimeException ex3);
  bool matWearMask(1: optional MatType matType, 2: optional binary matData, 3: required i32 width, 4: required i32 height, 5: optional CodeInfo faceInfo) throws (1: ServiceRuntimeException ex1);
  map<string, string> sdkCapacity() throws (1: ServiceRuntimeException ex1);
  list<FseResult> searchFaces(1: optional binary imgData, 2: optional CodeInfo facePos, 3: required double similarty, 4: required i32 rows, 5: optional list<string> imgMD5Set, 6: required i32 group) throws (1: ImageErrorException ex1, 2: NotFaceDetectedException ex2, 3: ServiceRuntimeException ex3);
  list<FseResult> searchFeatures(1: optional binary feature, 2: required double similarity, 3: required i32 rows, 4: optional list<string> imgMD5Set, 5: required i32 group) throws (1: ServiceRuntimeException ex1);
  bool wearMask(1: optional binary imgData, 2: optional CodeInfo faceInfo) throws (1: ImageErrorException ex1, 2: ServiceRuntimeException ex2);
}
